package com.jrx.anytxn.reporting.job.unionFile.step;

import com.jrx.anytxn.common.exception.TxnException;
import com.jrx.anytxn.reporting.job.unionFile.bean.TlPaymentBean;
import com.jrx.anytxn.reporting.service.IUnionFileService;
import com.jrx.anytxn.transaction.entity.TlPaymentLog;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UnionRepayFileProcessor implements ItemProcessor<TlPaymentLog, TlPaymentBean> {

    @Autowired
    private IUnionFileService unionFileService;

    @Override
    public TlPaymentBean process(TlPaymentLog item) throws TxnException {
        TlPaymentBean bean = new TlPaymentBean();
        //根据还款流水生成对应报表信息
        List<String> messageList = unionFileService.createRepayFileMessage(item);

        bean.setMessageList(messageList);

        return bean;
    }
}
